<?php 
/**
 * @version        $Id$
 * @author         master@xuewl.com
 * @copyright      Copyright (c) 2007 - 2014, Chongqing xuewl Information Technology Co., Ltd.
 * @link           http://www.xuewl.com
**/
namespace Member\Controller;
use \Member\Controller\InitController;
class AdvertsController extends InitController {
	
	public function _initialize() {
		parent::_initialize();
		$this->adverts_db=D('advert');
		$this->db = D('Member');
	}

	
	public function advert() {
		$info=max(1,I('get.',1,'intval'));
		$SEO=seo(0,"广告体验信息");
		$pagecurr = max(1,I('page',0,'intval'));
		$pagesize = 10;
		if ($info['type']== 1){
		$count = $this->adverts_db->where(array('userid'=>$this->userid))->count();
		$adverts = $this->adverts_db->where(array('userid'=>$this->userid))->page($pagecurr,$pagesize)->select();
		
		}else{
		$count = $this->adverts_db->count();
		/*$sqlmap=array();
		$sqlmap['userid']=array(array('EGT',$this->userid));*/
		$adverts = $this->adverts_db->page($pagecurr,$pagesize)->select();
		//echo  $this->adverts_db->getLastSql();
		}
		//var_dump($adverts);
		$pages = page($count,$pagesize);
		include template('advert');;
		
	}
	
	
	
}